package com.baox.agridata.synchronous.util;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

public class StringUtil {
    public static String getUUIDNonHyphen() {
        return UUID.randomUUID().toString().replace("-", "");
    }


    public static String getRandom(int len) {
        Random r = new Random();
        StringBuilder rs = new StringBuilder();
        for (int i = 0; i < len; i++) {
            rs.append(r.nextInt(10));
        }
        return rs.toString();
    }


    public static Integer AnimalTypeTurn(String animalName) {
        Integer animalType = null;

        if (animalName != null && !animalName.equals("")) {
            switch (animalName) {
                case "活猪":
                    animalType = 1;
                    break;
                case "活牛":
                    animalType = 2;
                    break;
                case "活羊":
                    animalType = 3;
                    break;
                case "活禽":
                    animalType = 4;
                    break;
                case "其他":
                    animalType = 5;
                    break;
                default:
                    break;
            }
        }
        return animalType;
    }


    public static Map statusTurnMap(Integer status){
        Map statusType = new HashMap();
        if(status != null ) {
            switch (status) {
                case 1701:
                    statusType.put("key", 1701);
                    statusType.put("Name", "在途");
                    break;
                case 1702:
                    statusType.put("key", 1702);
                    statusType.put("Name", "已回收");
                    break;
                case 1703:
                    statusType.put("key", 1703);
                    statusType.put("Name", "未回收");
                    break;
                case 1704:
                    statusType.put("key", 1704);
                    statusType.put("Name", "作废");
                    break;
            }
        }
        return statusType;
    }




}
